// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   GnuRSAKey.java

package gnu.crypto.key.rsa;

import java.math.BigInteger;
import java.security.Key;
import java.security.interfaces.RSAKey;

public abstract class GnuRSAKey
    implements Key, RSAKey
{

    protected GnuRSAKey(BigInteger n, BigInteger e)
    {
        this.n = n;
        this.e = e;
    }

    public BigInteger getModulus()
    {
        return getN();
    }

    public String getAlgorithm()
    {
        return "rsa";
    }

    /**
     * @deprecated Method getEncoded is deprecated
     */

    public byte[] getEncoded()
    {
        return getEncoded(1);
    }

    public String getFormat()
    {
        return null;
    }

    public BigInteger getN()
    {
        return n;
    }

    public BigInteger getPublicExponent()
    {
        return getE();
    }

    public BigInteger getE()
    {
        return e;
    }

    public boolean equals(Object obj)
    {
        if(obj == null)
            return false;
        if(!(obj instanceof RSAKey))
        {
            return false;
        } else
        {
            RSAKey that = (RSAKey)obj;
            return n.equals(that.getModulus());
        }
    }

    public abstract byte[] getEncoded(int i);

    private final BigInteger n;
    private final BigInteger e;
}
